home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
UpdateOnscreen.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
1KB
|
45 lines
#include "stdafx.h"
static void update_onscreen_list(cGameObject **above_screen, cGameObject **onscreen, cGameObject **below_screen)
{
cGameObject *n, *s;
// Put on screen stuff in below/above list
for (s = *onscreen; s != 0; s = n)
{
n = (cGameObject *)s->next;
s->update_list();
}
// Put above screen stuff in the on screen list when it comes on screen.
// The list needs to be sorted by sort_y2().
for (s = *above_screen; s != 0 && !s->above_screen(); s = n)
{
n = (cGameObject *)s->next;
s->update_list();
}
// Put below screen stuff in the on screen list when it comes on screen.
// The list needs to be sorted by rsort_y1().
for (s = *below_screen; s != 0 && !s->below_screen(); s = n)
{
n = (cGameObject *)s->next;
s->update_list();
}
}
void update_onscreen_list()
{
// Move objects on/off screen as they go
for (int i = 0; objtypes[i].type != 0; i++)
if (!objtypes[i].list_occured_earlier)
update_onscreen_list(objtypes[i].abovescreen, objtypes[i].onscreen, objtypes[i].belowscreen);
}